import * as Cesium from 'cesium'
export function changeOperation(viewer = window.cesiumViewer) {
  const { CameraEventType, KeyboardEventModifier } = Cesium

  viewer.scene.screenSpaceCameraController.zoomEventTypes = [
    CameraEventType.MIDDLE_DRAG, // 添加中键拖动缩放
    CameraEventType.WHEEL,
    CameraEventType.PINCH,
  ]

  viewer.scene.screenSpaceCameraController.tiltEventTypes = [
    CameraEventType.RIGHT_DRAG, // 右键拖动旋转
    CameraEventType.PINCH,
    {
      eventType: CameraEventType.LEFT_DRAG,
      modifier: KeyboardEventModifier.CTRL,
    },
    {
      eventType: CameraEventType.RIGHT_DRAG,
      modifier: KeyboardEventModifier.CTRL,
    },
  ]
}

export function restrictCamera(viewer = window.cesiumViewer) {
  /**
   * The angle, relative to the ellipsoid normal, restricting the maximum amount that the user can tilt the camera. If <code>undefined</code>, the angle of the camera tilt is unrestricted.
   * @type {number|undefined}
   * @default undefined
   *
   * @example
   * // Prevent the camera from tilting below the ellipsoid surface
   * viewer.scene.screenSpaceCameraController.maximumTiltAngle = Math.PI / 2.0;
   */
  viewer.scene.screenSpaceCameraController.maximumTiltAngle = Math.PI / 2.0

}
